package com.example.core.controller;

import com.example.core.service.BaseTreeService;
import com.example.core.utils.Result;
import com.example.core.vo.BaseTreeVo;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

public class BaseTreeController<S extends BaseTreeService, V extends BaseTreeVo> extends BaseController<S, V> {

    @GetMapping(value = "getTree")
    public Result getTree(HttpServletRequest request, HttpServletResponse response) {
        try {
            List list = this.getService().findTreeList(request, response);
            return Result.success(list);
        } catch (Exception e) {
            e.printStackTrace();
            return Result.error(e.getMessage());
        }
    }
}
